Some snippets for how to do things with Lazy.nvim
I use lazy.nvim for managing all of the
plugins I like to use. (Over a hundred of them!)
Here are a few snippet of code that might prove helpful.
Get the resulting spec of a plugin
Gets the computed spec (LazyPlugin type) of a plugin named “name”.
The name of a plugin is it’s directory name, commonly the trailing part
of the short reference. (e.g. from “foo/bar” it’ll be ‘bar’.) But that
can be overridden in a plugin by specifying the name key.
local plugin = require("lazy.core.config").spec.plugins[name]
Calculate the final set of options (opts) of a plugin
Calculates what the final value of opts would be for the plugin named “name”,
to be passed to the setup function of the plugin. If it’s already been
calculated, the cached value will be used.
local plugin = require("lazy.core.plugin")
return plugin.values(name, "opts", false)